{extend name="index_layout"/}

{block name="jscss"}
<style>
    .c {
        display: flex;
    }

    .c .left {
        width: 50% !important;
    }

    .c .right {
        width: 50%;
    }

    .file-item.thumbnail {
        width: 300px;
    !important;
    }

    .file-item.thumbnail a {
        height: 100%;!important;
    }

</style>
{/block}

{block name="main"}
<form class="layui-form" method="post">

    <!--    <button class="layui-btn" onclick="goBack()">back</button>-->

    <input type="hidden" name="id" value="{$data.id}">
    <input type="hidden" name="shop_id" value="{$data.shop_id}">
    <input type="hidden" name="salesperson_id" value="{$data.salesperson_id}">
    <div class="c">
        <div class="left">
            <div class="layui-form-item">
                <label class="layui-form-label">手机号码</label>
                <div class="layui-input-block">
                    <input type="text" value="{$data.phone}" name="row[phone]" autocomplete="off" placeholder="手机号码"
                           class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">开卡人姓名</label>
                <div class="layui-input-block">
                    <input type="text" value="{$data.people}" name="row[people]" autocomplete="off" placeholder="开卡人姓名"
                           class="layui-input">
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label">套餐类型</label>
                <div class="layui-input-block">
                    <select name="row[package_id]" lay-verify="required" lay-filter="ccc62" lay-search>
                        <option></option>
                        {volist name="packList" id="vo"}
                        <option value="{$vo.id}"
                        <?php if( $vo['id'] == $data['package_id']){ ?> selected <?php }?>>{$vo.name}</option>
                        {/volist}
                    </select>
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label">首冲金额</label>
                <div class="layui-input-block">
                    <input value="{$data.sc_money}" type="number" readonly name="row[sc_money]" lay-verify="required"
                           autocomplete="off"
                           placeholder="首冲金额(不填写为套餐默认值)"
                           class="layui-input"
                           id="sc_money"
                    >
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label">商家奖励</label>
                <div class="layui-input-block">
                    <input type="number" value="{$data.reward1}" name="row[reward1]" autocomplete="off"
                           placeholder="商家奖励(不填写为套餐默认值)"
                           class="layui-input"
                           id="reward1"
                    >
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">业务员奖励</label>
                <div class="layui-input-block">
                    <input type="number" value="{$data.reward2}" name="row[reward2]" autocomplete="off"
                           placeholder="业务员奖励(不填写为套餐默认值)"
                           class="layui-input"
                           id="reward2"
                    >
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">商家服务费</label>
                <div class="layui-input-block">
                    <input type="number" value="{$data.commission1}" name="row[commission1]" autocomplete="off"
                           placeholder="商家服务费(不填写为套餐默认值)"
                           class="layui-input"
                           id="commission1"
                    >
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label">业务员服务费</label>
                <div class="layui-input-block">
                    <input type="number" value="{$data.commission2}" name="row[commission2]" autocomplete="off"
                           placeholder="业务员服务费(不填写为套餐默认值)"
                           class="layui-input"
                           id="commission2"
                    >
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">审核状态</label>
                <div class="layui-input-block" id="is_c3">

                    <!--            <input type="radio" name="row[kf_status]" value="0" title="待审核" {if $data.kf_status==0}checked{/if}-->
                    <!--                   lay-filter="ccc3">-->

                    <input type="radio" name="row[kf_status]" value="1" title="审核通过" {if $data.kf_status==1}checked{/if}
                           lay-filter="ccc3">

                    <input type="radio" name="row[kf_status]" value="2" title="审核失败" {if $data.kf_status==2}checked{/if}
                           lay-filter="ccc3">
                </div>
            </div>

            <div class="layui-form-item r1">
                <label class="layui-form-label">审核失败原因</label>
                <div class="layui-input-block">
                    <input type="text" name="row[kf_refuse]" autocomplete="off" placeholder="审核失败原因" class="layui-input"
                           value="{$data.kf_refuse}">
                </div>
            </div>

            {if $data.status!=1}
            <div class="layui-form-item layer-footer">
                <div class="layui-input-block">
                    <button class="layui-btn" lay-submit="">立即提交</button>
                    <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                </div>
            </div>
            {/if}
        </div>


        <div class="right">
            <div class="layui-form-item">
                <label class="layui-form-label">号码图</label>
                <div class="layui-input-block">
                    <div class="w300">
                        <input value="{$data.hm_img}" type="text" lay-verify="required" name="row[hm_img]" id="c-pic2"
                               class="layui-input">
                    </div>
                    <button type="button" class="layui-btn faupload" id="faupload-pic2" data-multiple="false"
                            data-input-id="c-pic2"
                            data-preview-id="p-pic2" data-type="image"><i class="layui-icon layui-icon-upload"></i> 上传
                    </button>
                    <button type="button" class="layui-btn fachoose" data-multiple="false" data-mimetype="image"
                            data-input-id="c-pic2" id="fachoose-c-pic2"><i class="iconfont icon-other"></i> 选择
                    </button>
                    <ul class="layui-row list-inline plupload-preview" id="p-pic2">

                    </ul>
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">人证图</label>
                <div class="layui-input-block">
                    <div class="w300">
                        <input value="{$data.rz_img}" type="text" lay-verify="required" name="row[rz_img]" id="c-pic3"
                               class="layui-input">
                    </div>
                    <button type="button" class="layui-btn faupload" id="faupload-pic3" data-multiple="false"
                            data-input-id="c-pic3"
                            data-preview-id="p-pic3" data-type="image"><i class="layui-icon layui-icon-upload"></i> 上传
                    </button>
                    <button type="button" class="layui-btn fachoose" data-multiple="false" data-mimetype="image"
                            data-input-id="c-pic3" id="fachoose-c-pic3"><i class="iconfont icon-other"></i> 选择
                    </button>
                    <ul class="layui-row list-inline plupload-preview" id="p-pic3"></ul>
                </div>
            </div>
            {if $data.cns_type==1}
            <div class="layui-form-item">
                <label class="layui-form-label">承诺书图</label>
                <div class="layui-input-block">
                    <div class="w300">
                        <input value="{$data.cns_img}" type="text" lay-verify="required" name="row[cns_img]" id="c-pic1"
                               class="layui-input">
                    </div>
                    <button type="button" class="layui-btn faupload" id="faupload-pic1" data-multiple="false"
                            data-input-id="c-pic1"
                            data-preview-id="p-pic1" data-type="image"><i class="layui-icon layui-icon-upload"></i> 上传
                    </button>
                    <button type="button" class="layui-btn fachoose" data-multiple="false" data-mimetype="image"
                            data-input-id="c-pic1" id="fachoose-c-pic1"><i class="iconfont icon-other"></i> 选择
                    </button>
                    <ul class="layui-row list-inline plupload-preview" id="p-pic1"></ul>
                </div>
            </div>
            {else if}
            <div class="layui-form-item">
                <label class="layui-form-label">视频：</label>
                <div class="layui-upload layui-input-block">
                    <!--            <button type="button" name="video_upload" class="layui-btn btn_upload_video">-->
                    <!--                <i class="layui-icon">&#xe652;</i>上传视频-->
                    <!--            </button>-->
                    <br><br>
                    <div class="layui-progress layui-progress-big" width="300px" lay-showpercent="true"
                         lay-filter="progressBar" style="display: none">
                        <div id="progressBar" pb_loading_tag="1" class="layui-progress-bar layui-bg-red"
                             lay-percent="0%"></div>
                    </div>
                    <br>
                    <video class="video-upload-view" width="300px" src="{$data.cns_img}" controls="controls"></video>
                    <input type="hidden" name="row[cns_img]" class="save_url" value="{$data.cns_img}">
                </div>
            </div>
            {/if}
        </div>
    </div>


    <!--    <div class="layui-input-block">-->
    <!--        <div class="layui-col-xs4">-->
    <!--            <input type="text" name="{$vo.fieldArr}[{$vo.name}]"  id="c-{$vo.name}" value="{$vo.value|default=''}" class="layui-input">-->
    <!--        </div>-->
    <!--        <button type="button" class="layui-btn faupload" id="faupload-{$vo.name}" data-multiple="{$vo.type=='file'?'false':'true'}" data-input-id="c-{$vo.name}" data-preview-id="p-{$vo.name}" data-type="file"><i class="layui-icon layui-icon-upload"></i> 上传</button><button type="button" class="layui-btn fachoose" data-multiple="{$vo.type=='file'?'false':'true'}" data-mimetype="file" data-input-id="c-{$vo.name}" id="fachoose-c-{$vo.name}"><i class="iconfont icon-other"></i> 选择</button>-->
    <!--    </div>-->


</form>
{/block}
{block name="script"}
<script type="text/javascript">
    layui.use(['yznForm', 'laydate', 'form'], function () {
        var yznForm = layui.yznForm,
            laydate = layui.laydate;
        var form = layui.form;
        var $ = layui.jquery;

        yznForm.bindevent($("form.layui-form"));

        form.on('select(ccc62)', function (data) {
            console.log(data.value);
            $.ajax({
                type: "POST",//规定传输方式
                url: "{:url('getc_package')}",//提交URL
                data: {'id': data.value, 'order_id': {$data.id}},//提交的数据
                success: function (result) {
                    if (result.code == 200) {
                        $("#sc_money").val(result.data.sc_money);
                        $("#reward1").val(result.data.reward1);
                        $("#reward2").val(result.data.reward2);
                        $("#commission1").val(result.data.commission1);
                        $("#commission2").val(result.data.commission2);
                        console.log(result.data)
                        layui.form.render('select');
                    }
                },
                error: function () {
                    alert("获取信息失败")
                }
            });
            form.render();
        });
    });

</script>
{/block}